package com.atguigu.lease.common.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
// 扫描Mapper接口
@MapperScan(basePackages = {"com.atguigu.lease.*.mapper"})
@Configuration
public class MybatisPlusConfig {

    //配置分页拦截器
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();

        interceptor.addInnerInterceptor(paginationInnerInterceptor);
        return interceptor;
    }

}
